package org.linlinjava.litemall.admin.config;


import org.linlinjava.litemall.admin.util.MerchantInterceptor;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 *
 *
 */
@Configuration
public class MyBatisConfig {
    @Bean
    public MerchantInterceptor merchantInterceptor (){
        // 在insert update 加商户标识
        MerchantInterceptor merchantInterceptor = new MerchantInterceptor();
        return merchantInterceptor;
    }


    @Bean
    public ConfigurationCustomizer configurationCustomizer(){
        return new ConfigurationCustomizer() {
            @Override
            public void customize(org.apache.ibatis.session.Configuration configuration) {
                configuration.addInterceptor(merchantInterceptor());
            }
        };
    }
}
